Lang.bind(this, this._panelBoxChanged));
this.trayBox = new St.Widget({ name: 'trayBox',
+ clip_to_allocation: true,
layout_manager: new Clutter.BinLayout() });
- this.addChrome(this.trayBox);
+ this.addChrome(this.trayBox, { affectsInputRegion: false });
this.modalDialogGroup = new St.Widget({ name: 'modalDialogGroup',
layout_manager: new Clutter.BinLayout() });
init: function() {
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
+ let trayConstraint = new MonitorConstraint({ primary: true, work_area: true });
+ this.trayBox.add_constraint(trayConstraint);
+
this._loadBackground();
},
this.panelBox.set_size(this.primaryMonitor.width, -1);
this.keyboardIndex = this.primaryIndex;
-
- this.trayBox.set_position(this.bottomMonitor.x,
- this.bottomMonitor.y + this.bottomMonitor.height);
- this.trayBox.set_size(this.bottomMonitor.width, -1);
},
_panelBoxChanged: function() {
this.clearableCount = 0;
Main.layoutManager.trayBox.add_actor(this.actor);
- Main.layoutManager.trackChrome(this.actor);
+ Main.layoutManager.trackChrome(this.actor, { affectsInputRegion: true });
Main.layoutManager.trackChrome(this._closeButton);
global.screen.connect('in-fullscreen-changed', Lang.bind(this, this._updateState));
_onNotificationLeftTimeout: function() {
let [x, y, mods] = global.get_pointer();
- // We extend the timeout once if the mouse moved no further than MOUSE_LEFT_ACTOR_THRESHOLD to either side or up.
- // We don't check how far down the mouse moved because any point above the tray, but below the exit coordinate,
- // is close to the tray.
+ // We extend the timeout once if the mouse moved no further than MOUSE_LEFT_ACTOR_THRESHOLD to either side.
if (this._notificationLeftMouseX > -1 &&
+ y < this._notificationLeftMouseY + MOUSE_LEFT_ACTOR_THRESHOLD &&
y > this._notificationLeftMouseY - MOUSE_LEFT_ACTOR_THRESHOLD &&
x < this._notificationLeftMouseX + MOUSE_LEFT_ACTOR_THRESHOLD &&
x > this._notificationLeftMouseX - MOUSE_LEFT_ACTOR_THRESHOLD) {
this._updateState();
},
+ _clampOpacity: function() {
+ this.actor.opacity = Math.max(0, Math.min(this.actor._opacity, 255));
+ },
+
_onIdleMonitorBecameActive: function() {
this._userActiveWhileNotificationShown = true;
this._updateNotificationTimeout(2000);
this.actor.add_actor(this._notification.actor);
this.actor.opacity = 0;
- this.actor.y = 0;
+ this.actor.y = -this._notification.actor.height;
this.actor.show();
this._updateShowingNotification();
// We use this._showNotificationCompleted() onComplete callback to extend the time the updated
// notification is being shown.
- let tweenParams = { opacity: 255,
- y: -this.actor.height,
+ let tweenParams = { y: 0,
+ _opacity: 255,
time: ANIMATION_TIME,
- transition: 'easeOutQuad',
+ transition: 'easeOutBack',
+ onUpdate: this._clampOpacity,
+ onUpdateScope: this,
onComplete: this._showNotificationCompleted,
onCompleteScope: this
};
_notificationTimeout: function() {
let [x, y, mods] = global.get_pointer();
- if (y > this._lastSeenMouseY + 10 && !this._notificationHovered) {
+ if (y < this._lastSeenMouseY - 10 && !this._notificationHovered) {
// The mouse is moving towards the notification, so don't
// hide it yet. (We just create a new timeout (and destroy
// the old one) each time because the bookkeeping is
if (animate) {
this._tween(this.actor, '_notificationState', State.HIDDEN,
- { y: this.actor.height,
- opacity: 0,
+ { y: -this.actor.height,
+ _opacity: 0,
time: ANIMATION_TIME,
- transition: 'easeOutQuad',
+ transition: 'easeOutBack',
+ onUpdate: this._clampOpacity,
+ onUpdateScope: this,
onComplete: this._hideNotificationCompleted,
onCompleteScope: this
});
} else {
Tweener.removeTweens(this.actor);
- this.actor.y = this.actor.height;
+ this.actor.y = -this.actor.height;
this.actor.opacity = 0;
this._notificationState = State.HIDDEN;
this._hideNotificationCompleted();
},
_expandNotification: function(autoExpanding) {
- if (!this._notificationExpandedId)
- this._notificationExpandedId =
- this._notification.connect('expanded',
- Lang.bind(this, this._onNotificationExpanded));
// Don't animate changes in notifications that are auto-expanding.
this._notification.expand(!autoExpanding);
this._ensureNotificationFocused();
},
- _onNotificationExpanded: function() {
- let expandedY = - this.actor.height;
- this.actor.set_child_above_sibling(this._closeButton, null);
- this._closeButton.show();
-
- // Don't animate the notification to its new position if it has shrunk:
- // there will be a very visible "gap" that breaks the illusion.
- if (this.actor.y < expandedY) {
- this.actor.y = expandedY;
- } else if (this._notification.y != expandedY) {
- // Tween also opacity here, to override a possible tween that's
- // currently hiding the notification.
- Tweener.addTween(this.actor,
- { y: expandedY,
- opacity: 255,
- time: ANIMATION_TIME,
- transition: 'easeOutQuad',
- // HACK: Drive the state machine here better,
- // instead of overwriting tweens
- onComplete: Lang.bind(this, function() {
- this._notificationState = State.SHOWN;
- }),
- });
- }
- },
-
_ensureNotificationFocused: function() {
this._notificationFocusGrabber.grabFocus();
}